• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • CairoSvgSurface::getVersions()

    (PECL cairo >= 0.1.0)

    Used to retrieve a list of supported SVG versions

    说明

    面向对象风格(method):

    publicstaticCairoSvgSurface::getVersions(void): array

    过程化风格:

    cairo_svg_get_versions(void): array

    Returns a numerically indexed array of currently available CairoSvgVersion constants. In order to retrieve the string values for each item, use CairoSvgSurface::versionToString().

    参数

    此函数没有参数。

    返回值

    Returns a numerically indexed array of integer values.

    范例

    Example #1 CairoSvgSurface::getVersions() example

    <?php
    /* Grab our list of versions */
    $versions = CairoSvgSurface::getVersions();
    var_dump($versions);
    /* echo the string name of each version */
    foreach($versions as $id) {
        echo CairoSvgSurface::versionToString($id), PHP_EOL;
    }
    ?>
    

    以上例程的输出类似于:

    array(2) {
      [0]=>
      int(0)
      [1]=>
      int(1)
    }
    SVG 1.1
    SVG 1.2
    

    Example #2 过程化风格

    <?php
    /* Grab our list of versions */
    $versions = cairo_svg_surface_get_versions();
    var_dump($versions);
    /* echo the string name of each version */
    foreach($versions as $id) {
        echo cairo_svg_surface_version_to_string($id), PHP_EOL;
    }
    ?>
    

    以上例程的输出类似于:

    array(2) {
      [0]=>
      int(0)
      [1]=>
      int(1)
    }
    SVG 1.1
    SVG 1.2
    

    参见

    • CairoSvgSurface::versionToString() The versionToString purpose